﻿using Compass.Wasm.Shared.Wms;
using Compass.WmsService.Domain.Entities;

namespace Compass.WmsService.Domain;

public interface IWmsRepository
{
    //Vendor
    Task<IQueryable<Vendor>> GetVendorsAsync();
    Task<Vendor?> GetVendorByIdAsync(Guid id);
    //扩展Project查询
    Task<Vendor?> GetVendorByNumberAsync(string number);
    Task<IQueryable<Vendor>> GetTop5VendorsByKeywordAsync(string? keyword);

    //Cargo
    Task<IQueryable<Cargo>> GetCargoesAsync();
    Task<Cargo?> GetCargoByIdAsync(Guid id);
    //扩展Project查询
    Task<Cargo?> GetCargoByMtlNumberAsync(string mtlNumber);
    Task<IQueryable<Cargo>> GetCargoesByAreaAsync(Warehouse_e warehouse, Area_e area, string ranks);
    Task<Cargo?> GetCargoByLocationAsync(string location);
    
    Task<IQueryable<Cargo>> GetTop5CargoesByKeywordAsync(string? keyword);
    
    //Location
    Task<IQueryable<Location>> GetLocationsAsync();
    Task<Location?> GetLocationByIdAsync(Guid id);
    //扩展Location查询
    Task<Location?> GetLocationByNameAsync(string name);
    Task<IQueryable<Location>> GetLocationsByAreaAsync(Warehouse_e warehouse,Area_e area, string ranks);

    //Inventory
    Task<IQueryable<Inventory>> GetInventoriesAsync();
    Task<Inventory?> GetInventoryByIdAsync(Guid id);
    //扩展Inventory查询
    Task<Inventory?> GetInventoryLastByCargoAsync(Guid cargoId);//查询某个料的最后一次盘存记录
    Task<IQueryable<Inventory>> GetInventoriesByCargoAsync(Guid cargoId);//查询某个料的所有盘存记录
    Task<IQueryable<Inventory>> GetInventoriesByPeriodAsync(DateTime start, DateTime end);//查询某段时间的盘存记录


    //StockIn
    Task<IQueryable<StockIn>> GetStockInsAsync();
    Task<StockIn?> GetStockInByIdAsync(Guid id);
    //扩展Inventory查询
    Task<IQueryable<StockIn>> GetStockInsFromLastByCargoAsync(Guid cargoId, DateTime last);//查询某个料的从最后一次盘存记录开始
    Task<IQueryable<StockIn>> GetStockInsByCargoAsync(Guid cargoId);//查询某个料的所有入库记录
    Task<IQueryable<StockIn>> GetStockInsByPeriodAsync(DateTime start, DateTime end);//查询某段时间的入库记录

    //StockIn
    Task<IQueryable<StockOut>> GetStockOutsAsync();
    Task<StockOut?> GetStockOutByIdAsync(Guid id);
    //扩展Inventory查询
    Task<IQueryable<StockOut>> GetStockOutsFromLastByCargoAsync(Guid cargoId, DateTime last);//查询某个料的从最后一次盘存记录开始
    Task<IQueryable<StockOut>> GetStockOutsByCargoAsync(Guid cargoId);//查询某个料的所有出库记录
    Task<IQueryable<StockOut>> GetStockOutsByPeriodAsync(DateTime start, DateTime end);//查询某段时间的出库记录

}